package com.lhkj.ct.meta.admin.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.lhkj.ct.meta.admin.model.entity.TblOrgan;
import com.lhkj.ct.meta.admin.model.vo.OrganTreeVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 机构表 Mapper 接口
 * </p>
 *
 * @author jobob
 * @since 2023-09-12
 */
public interface SysOrganMapper extends BaseMapper<TblOrgan> {

    @Select("select ${ew.sqlSelect} from tbl_organ ${ew.customSqlSegment}")
    List<OrganTreeVo> listOrgans(@Param(Constants.WRAPPER) Wrapper<TblOrgan> wrapper);

    /**
     * 查询机构底下部门数量
     * @param organId
     * @return
     */
    Long hasDept(String organId);
}
